import * as types from '../actionTypes/todos.js'
const initialState = [
  { id: 1, text: '吃饭', done: true },
  { id: 2, text: '学习', done: false },
  { id: 3, text: '睡觉', done: true }
]

const todos = (state = initialState, action) => {
  console.log(action);
  switch (action.type) {
    case types.DEL_TODO:
      return state.filter(item=> item.id !== action.payload)
    default:
      return state
  }
}

export default todos